﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NHibernate;
using WebEx.Service;

namespace WebEx.reg
{
    public partial class RegIndex : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void BtnReg_Click(object sender, EventArgs e)
        {
            try
            {
                NHibernateHelper helper = new NHibernateHelper();
                ISession session = helper.GetSession();


                User user = new User();

                user.UserName = this.tbxUserName.Text;
                user.UserPassword = this.tbxPassWord.Text;
                user.UserRoleID = "3";
                user.UserState = "4";
                session.Save(user);

                session.Flush();

                Session["UserID"] = user.UserID;

                Response.Redirect("/Default.aspx");
            }
            catch (Exception ex)
            {

                throw;
            }
        }

        

        
    }
}